Skip to content

Split annotation header from codegen tool via APIARY_BUILD_TOOL#2

Merged
jturney merged 1 commit into
mainfrom
feature/build-tool-option
Jun 5, 2026
Merged

Split annotation header from codegen tool via APIARY_BUILD_TOOL#2
jturney merged 1 commit into
mainfrom
feature/build-tool-option

Conversation

@jturney

@jturney jturney commented Jun 5, 2026

Copy link
Copy Markdown
Member

Add an APIARY_BUILD_TOOL option (default ON) that gates the libtooling executable separately from the header-only annotation contract.

Previously, descending into this CMakeLists always ran find_package(Clang/LLVM) and built the apiary executable, and the apiary_annotations target + its header install only happened as a side effect of that descent. A consumer that wanted just the APIARY_* macros (every annotated C++ TU) was forced to pull in the full Clang/LLVM dev stack, and gating the descent to avoid that silently dropped the annotation-header install too — leaving find_package(Apiary) and install trees without apiary/Annotations.hpp.

Now:

  • apiary::annotations (INTERFACE) and the include/apiary header install are unconditional — no Clang/LLVM required.
  • find_package(Clang/LLVM), the apiary executable, its links, alias, and the tool-driven smoke/golden/pyi tests are guarded by APIARY_BUILD_TOOL. The pure-Python doc_lint test still runs either way.
  • The executable joins the ApiaryTargets export only when built; ApiaryConfig sets APIARY_TOOL_FOUND and documents that apiary::apiary may be absent in a header-only install.

This lets a consumer (Einsums) vendor the annotation macros in a pure-C++ build while enabling the tool only for bindings generation or docs.

Verified: APIARY_BUILD_TOOL=OFF configures and installs with no Clang/LLVM and ships include/apiary/Annotations.hpp; =ON finds LLVM and builds the executable as before.

Add an APIARY_BUILD_TOOL option (default ON) that gates the libtooling
executable separately from the header-only annotation contract.

Previously, descending into this CMakeLists always ran
find_package(Clang/LLVM) and built the apiary executable, and the
apiary_annotations target + its header install only happened as a
side effect of that descent. A consumer that wanted just the APIARY_*
macros (every annotated C++ TU) was forced to pull in the full
Clang/LLVM dev stack, and gating the descent to avoid that silently
dropped the annotation-header install too — leaving find_package(Apiary)
and install trees without apiary/Annotations.hpp.

Now:
  * apiary::annotations (INTERFACE) and the include/apiary header install
    are unconditional — no Clang/LLVM required.
  * find_package(Clang/LLVM), the apiary executable, its links, alias,
    and the tool-driven smoke/golden/pyi tests are guarded by
    APIARY_BUILD_TOOL. The pure-Python doc_lint test still runs either way.
  * The executable joins the ApiaryTargets export only when built;
    ApiaryConfig sets APIARY_TOOL_FOUND and documents that apiary::apiary
    may be absent in a header-only install.

This lets a consumer (Einsums) vendor the annotation macros in a pure-C++
build while enabling the tool only for bindings generation or docs.

Verified: APIARY_BUILD_TOOL=OFF configures and installs with no
Clang/LLVM and ships include/apiary/Annotations.hpp; =ON finds LLVM and
builds the executable as before.

Signed-off-by: Justin Turney <justin.turney@gmail.com>
@jturney jturney merged commit 8ce7706 into main Jun 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant